/**
 * Copyright 2010 Pavel Daniel Alexandru PFA
 * 
 * Licensed under the terms of the GNU Lesser General Public License version 3 
 * as published by the Free Software Foundation. You may obtain a copy of the
 * License at: http://www.gnu.org/copyleft/lesser.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations 
 * under the License. 
 */
package com.kobol.webclient.client.sales.view;

import com.kobol.webclient.client.model.ActivityData;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.grid.ListGridField;

/**
 * @author Pavel Alexandru
 * 
 */
public class ActivitiesContextAreaListGrid extends SalesContextAreaListGrid {

    private static final String ICON = "icon";
    private static final String ACTIVITY_TYPE = "activityType";
    private static final String SUBJECT = "subject";
    private static final String REGARDING = "regarding";
    private static final String PRIORITY = "priority";
    private static final String START_DATE = "startDate";
    private static final String DUE_DATE = "dueDate";

    public ActivitiesContextAreaListGrid() {
	super();

	// show the List Grid filter editor
	// this.setShowFilterEditor(false);
	// this.setFilterOnKeypress(true);

	// initialise the List Grid fields
	ListGridField iconField = new ListGridField(ICON, "#", 27);
	iconField.setImageSize(16);
	iconField.setAlign(Alignment.CENTER);
	iconField.setType(ListGridFieldType.IMAGE);
	iconField.setImageURLPrefix("icons/16/");
	iconField.setImageURLSuffix(".png");

	ListGridField activityTypeField = new ListGridField(ACTIVITY_TYPE, "Activity Type", 90);
	ListGridField subjectField = new ListGridField(SUBJECT, "Subject", 130);
	ListGridField regardingField = new ListGridField(REGARDING, "Regarding", 100);
	ListGridField priorityField = new ListGridField(PRIORITY, "Priority", 60);
	ListGridField startDateField = new ListGridField(START_DATE, "Start Date", 80);
	ListGridField dueDateField = new ListGridField(DUE_DATE, "Due Date", 80);

	ListGridField emptyField = new ListGridField("emptyField", " ");

	// set the fields into the List Grid
	this.setFields(new ListGridField[] { iconField, activityTypeField, subjectField, regardingField, priorityField,
		startDateField, dueDateField, emptyField });

	// populate the List Grid
	this.setData(ActivityData.getRecords());
    }
}